package com.shiguiwu.springmybatis.designpattern.observe.service.impl;

import com.shiguiwu.springmybatis.designpattern.observe.LotteryResult;
import com.shiguiwu.springmybatis.designpattern.observe.service.LotteryService;
import com.shiguiwu.springmybatis.designpattern.observe.service.MinibusTargetService;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

/**
 * @description: 实现
 * @author: stone
 * @date: Created by 2021/9/3 14:46
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.designpattern.observe.service.impl
 */
@Slf4j
public class LotteryServiceImpl extends LotteryService {

    private MinibusTargetService minibusTargetService = new MinibusTargetService();


    @Override
    public LotteryResult doDraw(String userId) {
        //摇号
        String lottery = minibusTargetService.lottery(userId);
        // 垃圾代码
        //log.info("发送短信消息 =======>{}", lottery);
        //
        //log.info("发送MQ消息 =======>{}", lottery);
        //结果
        return new LotteryResult(userId, lottery, new Date());
    }
}
